// 首页
// https://pharyzl.cn/

// 登录
// https://pharyzl.cn/login.html

// 接单
// https://pharyzl.cn/dispatch


let token = Android.getMap("token")
document.cookie = token



function getParameterHandler() {
    let headers = {
        "cookie": parameter.getMap("token")
    }
    let body = {}
    let strUrl = `?ver=1.01&plat=tb&type=`
    let url = parameter.getMap("url") + strUrl
    return {
        mediaType: "form",
        requestType: "POST",
        url: url,
        headers: JSON.stringify(headers),
        body: JSON.stringify(body)
    }
}
getParameterHandler()



function getResponse() {
    let res = response.getMap("res")
    let code = "500"
    let message = "接单中"
    let dataKey = ""
    let dataValue = ""

    try {
        res = JSON.parse(res)
        if (res["status"] == 1) {
            code = "200"
             message = "接单成功，请尽快完成"
        } else {
            code = "500"
            message = "实在抱歉，亲，这会儿任务抢完了，过会儿再来喔。"
        }
    } catch (e) {
        code = "300"
        message = "登录过期"
    }

    return {
        code: code,
        message: message,
        dataKey: dataKey,
        dataValue: dataValue
    }
}
getResponse()


// {
// 	"status": 0,
// 	"info": "none",
// 	"order_number": "",
// 	"bypass": "",
// 	"url": "",
// 	"mall": "tb"
// }